//
//  HWInteractiveViewController.m
//  HWanGame
//
//  Created by 陈道斌 on 2019/8/29.
//  Copyright © 2019 Chendaobin. All rights reserved.
//

#import "HWInteractiveViewController.h"
#import "HWXiaoXiTableViewCell.h"
#import  "HWUserXiaoXiCell.h"

@interface HWInteractiveViewController ()<UITableViewDelegate,UITableViewDataSource>
@property(strong,nonatomic) UITableView *mainaTableVie;
@property(strong,nonatomic) NSArray *dataArr;

@end

@implementation HWInteractiveViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    // 123456
    
    //  设置属性
    [self setUpAttribute];
    
     // 设置UI
    [self setupUI];
}

#pragma mark -------   设置属性
- (void)setUpAttribute {
    
    self.dataArr = @[@"message_like",@"message_collect",@"message_mes"];
    
    
}


-(UITableView *)mainaTableVie {
    
    if (_mainaTableVie == nil
        ) {
        
        
        _mainaTableVie = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, kScreenH-CF_NavHeight-118) style:UITableViewStylePlain];
        _mainaTableVie.delegate = self;
        _mainaTableVie.dataSource = self;
        _mainaTableVie.separatorStyle = UITableViewCellSeparatorStyleNone;
        _mainaTableVie.backgroundColor = [UIColor whiteColor];
        
    }
    return   _mainaTableVie ;
}

- (void)setupUI {
    self.view.backgroundColor = [UIColor orangeColor];
    [self.view addSubview:self.mainaTableVie];
    
}


#pragma mark -----  UITableViewDataSource 
-  (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    
    return  2;
    
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    if (section == 0) {
        return  3;
    }
    return  13;
}



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    
    if (indexPath.section == 0) {
        
        static NSString *cellId = @"cellID";
        
        HWXiaoXiTableViewCell  *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
        if (!cell) {
            cell =  [[NSBundle mainBundle]loadNibNamed:@"HWXiaoXiTableViewCell" owner:nil options:nil].lastObject;
        }
        cell.selectionStyle =  UITableViewCellSelectionStyleNone;
        cell.icoimageView.image = [UIImage imageNamed:self.dataArr[indexPath.row]];
        if (indexPath.row == 2) {
            cell.xiayigimageview.hidden = NO;
        }else {
            cell.xiayigimageview.hidden = YES;
        }
        cell.backgroundColor = [UIColor whiteColor];
         return  cell;
        
    } else {
        
        static NSString *cellId = @"cell1ID";
        
        HWUserXiaoXiCell  *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
        if (!cell) {
            cell =  [[NSBundle mainBundle]loadNibNamed:@"HWUserXiaoXiCell" owner:nil options:nil].lastObject;
        }
         cell.backgroundColor = [UIColor whiteColor];
        cell.selectionStyle =  UITableViewCellSelectionStyleNone;
        return  cell;
        
        
        
    }
    
   
  
    
    
   
    
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    
    return  68;
}


- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    
    return  1;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    
    return  6;
    
}


- (nullable UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    
    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, 1)];
    
    return  view;
    
    
}
- (nullable UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
    
    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, 6)];
    if(section == 0) {
        view.backgroundColor = RGB(239, 236, 239);
        
        
    } else {
        view.backgroundColor =  [UIColor whiteColor];
    }
    
    return  view;
    
}


@end
